package com.wzq.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzq.dao.pojo.Space;
import com.wzq.mapper.Spacemapper;
import com.wzq.service.ISpaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yzc
 * @since 2022-08-31
 */
@Service
public class SpaceServiceImpl extends ServiceImpl<Spacemapper, Space> implements ISpaceService {
            @Autowired
            private Spacemapper spacemapper;

    //    根据用户ID获取该用户下的所有空间
    @Override
    public List<Space> getSpaceByUserId(Integer w_id) {

        return spacemapper.getSpaceByUserId(w_id);
    }

    //    根据用户ID获取该用户下的所有空间（p_id为空时 我的页面展示作用）
    @Override
    public List<Space> getSpaceByUserIdNoPid(Integer w_id) {
        return spacemapper.getSpaceByUserIdNoPid(w_id);
    }

    //是否收藏
    @Override
    public List<Space> isfavorites(Integer w_id, Integer p_id) {
        return spacemapper.isfavorites(w_id,p_id);
    }

    @Override
    public int deleteSpaceByIdAndSpaceName(String w_id, String spacename) {
        return spacemapper.deleteSpaceByIdAndSpaceName(w_id,spacename);
    }
}
